// WaveProb.H

#ifndef WAVEPROB_H
#define WAVEPROB_H

#include <math.h>

// Forward Declarations
class Epetra_SerialComm;
class Epetra_Map; 
class Epetra_Vector;
class Epetra_Import;
class Epetra_CrsGraph;
class Epetra_CrsMatrix;


class WaveProb
{ 
  protected:
    int M;
    int N;
    double P0;
    double Q;
    bool firstFill;
    Epetra_Map *map;
    Epetra_Vector *initial;
    Epetra_CrsMatrix *J;

    virtual double Gamma(double p) = 0;
    void insert(int r, int num, double *v, int *c);

    virtual void computeInitial(double lambda) = 0;
    double newton(double guess);
    double fGammaGen(double lambda);
    double dfGammaGen(double lambda);


  public:
    virtual ~WaveProb(){}

    int getM() const { return M; }
    int getN() const { return N; }
    double getP0() const { return P0; }
    double getQ() const { return Q; }
    Epetra_Vector & getInitial() const { return *initial; }
    Epetra_CrsMatrix & getJacobian() const { return *J; }

    void setQ(double q) { Q = q; }

    bool computeF(const Epetra_Vector &x, Epetra_Vector &f);
    bool computeJacobian(const Epetra_Vector &x);
};

#endif

